<template>
  <div class="goods">
    <!-- 这里再把每一项的item通过product props再传递给子组件 -->
    <GoodsListItem
      v-for="item in goods"
      :product="item"
      :key="item.id"
    ></GoodsListItem>
  </div>
</template>

<script>
import GoodsListItem from "./GoodsListItem";
export default {
  name: "GoodsList",
  props: {
    goods: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  components: {
    GoodsListItem,
  },
};
</script>

<style lang='less'>
.goods {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around; //四周环绕
  padding: 5px;
}
</style>